package com.xiyou.luckdraw.api.dto.login;

import com.xiyou.luckdraw.common.constants.ResultCodeConstants;
import com.xiyou.luckdraw.common.exception.ValidateException;
import com.xiyou.luckdraw.common.result.AbstractRequest;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.apache.commons.lang3.StringUtils;

/**
 * @ClassName: UserModifyRequest
 * @Description:
 * @author: limingxing
 * @Date: 2019-10-18 20:19
 */
@Data
@ApiModel(value = "修改系统用户密码请求参数")
public class UserModifyRequest extends AbstractRequest {

    private Long id;
    @ApiModelProperty(value="新密码")
    private String password;
    @ApiModelProperty(value="旧密码")
    private String oldPassword;
    private String name;

    @Override
    public void requestCheck() {
        if(StringUtils.isBlank(oldPassword)){
            throw new ValidateException(
                    ResultCodeConstants.REQUEST_CHECK_FAILURE.getCode(),
                    ResultCodeConstants.REQUEST_CHECK_FAILURE.getMessage());
        }
    }
}
